package com.cloud.seatatmone.service;

import com.cloud.seatatmone.dao.TblOneMapper;
import com.cloud.seatatmone.entity.TblOne;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class Seata_AT_Service {

    @Autowired
    private TblOneMapper oneMapper;

    @Autowired
    private RestTemplate restTemplate;

    public String testAT(){

        TblOne one = TblOne.Build().name("seata AT 模式测试").build();

        oneMapper.insertTblOne(one);

        restTemplate.postForEntity("http://seata-rm-two/test_AT",null,null);

        restTemplate.postForEntity("http://seata-rm-three/test_AT",null,null);

        int i = 1/0;
        return "测试完成";
    }
}
